<div>
    <div style="border-bottom: 1px solid #A7D36B;  padding-bottom: 5px">
    Number of Positions:<br>
    <input onchange="calculate('position');" class="" size="7" id="position" value="0" type="text"/>
    <a href="javascript:calculate('position');" class="btn_calc buttons"><input style="padding: 2px 5px" type="button" value="Calculate" /></a>
    </div>
    <div style="background: #fff; border: 1px solid #e5e5e5;margin-bottom: 5px; padding: 5px">
    Principal Amount Required:<br>
    <input style="background: #e5e5e5; border: 1px solid #eee; text-align: right" size="7" id="amount" value="0" type="text" readonly="readonly"/>&nbsp;<small>USD</small><br />

    Total Returned (in 80 days)<br>
    <input style="background: #e5e5e5; border: 1px solid #eee; text-align: right" size="7" id="returnf" value="0" type="text" readonly="readonly"/>
    &nbsp;<small>USD&nbsp;(WITHOUT COMPOUNDING)</small><br />
    </div>
</div>
<script type="text/javascript">
        function calculate(id) {
            var obj = document.getElementById(id);
            if (!obj.value) {
                alert("Please enter number of positions");
            }
            var reqAmount = obj.value * 10
            document.getElementById("amount").value = reqAmount;

            var returna = reqAmount * 2 * 80 / 100
            document.getElementById("returnf").value = returna;
        }
</script>